﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zocono.Infrastructure.Common;
using Zocono.WCS.Domain.DomainRepository;
using Zocono.WCS.Domain.EntityInfo;

namespace Zocono.WCS.Domain.WorkTaskDomain
{
    public class TaskRouteDetailRecordInfoService : ITaskRouteDetailRecordInfoService
    {
        private readonly ILogUtil _LogUtil;
        private readonly ISnowflake _Snowflake;
        private readonly ITaskRouteDetailRecordInfoRepository _TaskRouteDetailRecordInfoRepository;

        public TaskRouteDetailRecordInfoService(ILogUtil logUtil
            , ISnowflake snowflake
            , ITaskRouteDetailRecordInfoRepository taskRouteDetailRecordInfoRepository)
        {
            _LogUtil = logUtil;
            _Snowflake = snowflake;
            _TaskRouteDetailRecordInfoRepository = taskRouteDetailRecordInfoRepository;
        }

        /// <summary>
        /// 获取任务详情
        /// </summary>
        /// <param name="taskId"></param>
        /// <returns></returns>
        public async Task<List<TaskRouteDetailRecordInfo>> GetTaskRouteDetailRecordInfoAsync(long taskId)
        {
            var exp = Expressionable.Create<TaskRouteDetailRecordInfo>();
            exp.AndIF(true, it => it.TaskID == taskId);

            var list = await _TaskRouteDetailRecordInfoRepository.GetListAsync(exp.ToExpression());

            return list;
        }
    }
}
